import React from 'react';
import MHeader from './m_header';
import MFooter from './m_footer';
import {Row, Col, BackTop} from 'antd';
import CommonComments from './common_comments';
export default class MNewsDetails extends React.Component {
	constructor(props) {
		super(props);
		this.state={
			newsItem:''
		};
	};
	componentWillMount() {
		console.log("Sss");

	};
	componentDidMount() {
		var myFetchOptions = {
			method: 'GET'
		};
		fetch("http://newsapi.gugujiankong.com/Handler.ashx?action=getnewsitem&uniquekey=" +this.props.match.params.uniquekey
			,myFetchOptions)
		.then(response=>response.json())
		.then(json=>{
			this.setState({newsItem:json});
			document.title=this.state.newsItem.title+"- React News | React 驱动的新闻平台";
		});
	};

	createMarkup() {
		return {__html:this.state.newsItem.pagecontent};
	};

// <CommonComments uniquekey={this.props.params.uniquekey}/>
	render() {
		return (
			<div id="mobileDetailsContainer">
			<MHeader></MHeader>
			<div class="ucmobileList">
				<Row>
				<Col span={24} className="container">
					<div class="articleContainer" dangerouslySetInnerHTML={this.createMarkup()}></div>
					<hr/>
					<CommonComments uniquekey={this.props.match.params.uniquekey}/>
				</Col>
				</Row>
			</div>
			<MFooter></MFooter>
			<BackTop />
			</div>
		)
	}

}